//
//  BPNavViewController.swift
//  BPWeiBo
//
//  Created by apple on 16/4/8.
//  Copyright © 2016年 apple. All rights reserved.
//

import UIKit

class BPNavViewController: UINavigationController,UIGestureRecognizerDelegate {

    override func viewDidLoad() {
        super.viewDidLoad()
        self.navigationBar.setBackgroundImage(UIImage(named: "navBar"), forBarMetrics: .Default)
        self.interactivePopGestureRecognizer?.delegate = nil
    }
    
    override func pushViewController(viewController: UIViewController, animated: Bool) {
        
        if childViewControllers.count > 0 {
            var title1 = "返回"
            if childViewControllers.count == 1 {
              title1 = (childViewControllers.first?.title ?? nil)!
            }
            viewController.navigationItem.leftBarButtonItem = UIBarButtonItem(imgName: "navigationbar_back_withtext", title: title1, target: self, action: "pop")
            //隐藏底部的状态栏
            //viewController.hidesBottomBarWhenPushed = true
            //隐藏底部的状态栏
            viewController.hidesBottomBarWhenPushed = true
            viewController.view.backgroundColor = UIColor(red: 236 / 255.0, green: 236 / 255.0, blue: 236 / 255.0, alpha: 1)

        }

        super.pushViewController(viewController, animated: animated)

    }

    
    @objc private func pop() {
        self.popViewControllerAnimated(true)
    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
    
    

}
